package com.pactera.asmp.server.entity;

import com.pactera.asmp.server.pojo.DeviceInfoWithProject;
import com.pactera.asmp.server.pojo.MasterComputerWithProDeviceCount;

import java.util.List;

import lombok.Data;

/**
 * @ProjectName: asmpserver
 * @Package: com.pactera.asmp.server.entity
 * @ClassName: ProjectMasterComDeviceVo
 * @Author: lvzhiqiang
 * @Description: 上位机-设备关联实体
 * @Date: 2019/8/9 15:47
 * @Version: 1.0
 */
@Data
public class ProjectMasterDeviceVo implements Comparable<ProjectMasterDeviceVo> {

    private MasterComputerWithProDeviceCount masterComputer;

    private List<DeviceInfoWithProject> deviceInfos;

    @Override
    public int compareTo(ProjectMasterDeviceVo o) {
        // 1. 上位机绑定设备数据从多到少
        if(this.getMasterComputer().getProDeviceCount().intValue() != o.getMasterComputer().getProDeviceCount().intValue()){
            return o.getMasterComputer().getProDeviceCount().intValue() - this.getMasterComputer().getProDeviceCount().intValue();
        }
        return 0;
    }
}
